package com.fengmi.entity;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

@Data
@Document(indexName = "es_user_3",shards = 2,replicas = 1)
public class ESUser {
    @Id
    private Integer id;
    @Field(store = true,type = FieldType.Integer)
    /**
     * type:指定域在es中的类型
     * Integer=>FieldType.Integer
     * 若类型为Integer,Double,Date 对应的域时不会进行分词的
     * 若类型为String（Field.Text）,对应的域一定会分词,如商品名称
     * 若类型为String(FieldType.Keyword),对应的域不会分词，如品牌名称
     *
     *
     * store:指定该域需不需要存储，默认值为false
     * 一般大文本可将store设置为false,
     * analyzer:指定分词器(默认：standard、ik_max_word,ik_smart)
     * 当type=FieldType.Text  必须指定分词器
     */
    private Integer account_number;
    @Field(store = true,type = FieldType.Integer)
    private Integer balance;
    @Field(store = true,type = FieldType.Keyword)
    private String firstname;
    @Field(store = true,type = FieldType.Keyword)
    private String lastname;
    @Field(store = true,type = FieldType.Integer)
    private Integer age;
    @Field(store = true,type = FieldType.Integer)
    private Integer gender;
    @Field(store = true,type = FieldType.Text,analyzer = "ik_max_word")
    private String address;
    @Field(store = true,type = FieldType.Text,analyzer = "ik_max_word")
    private String job;
    @Field(store = true,type = FieldType.Keyword)
    private String email;
    @Field(store = true,type = FieldType.Keyword)
    private String city;
    @Field(store = true,type = FieldType.Keyword)
    private String state;

}